package com.showtao.common.security.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.showtao.front.domain.BaseDomain;

@SuppressWarnings("serial")
@Entity
@Table(name = "st_permission")
public class Permission extends BaseDomain {

    @Id
    @Column
    private String permission;
    @Column
    private String description;

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        } else if (!this.getClass().isInstance(obj)) {
            return false;
        }
        return new EqualsBuilder().append(permission, ((Permission) obj).getPermission()).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(permission).toHashCode();
    }
}
